package day01;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class JDBCTest {
    public static void main(String[] args) throws Exception {
        String url = "jdbc:mysql://localhost:3306/empdb?characterEncoding=utf8&useSSL=false";
        String username = "root";
        String pasword = "root";
        ResultSet rs = null;
        Connection conn = DriverManager.getConnection(url,username,pasword);
        Statement s = conn.createStatement();
        rs = s.executeQuery("select * from emp");
        while(rs.next()){
            System.out.println(rs.getInt("id")+",\t"+
                    rs.getString("name")+",\t"+
                    rs.getString("job")+",\t"+
                    rs.getDouble("sal"));
        }
        conn.close();
    }
}
